#include <iostream>
#include <string>
#include <cmath>

using namespace std;

bool isPrime(int num)
{
    if (num <= 1)
    {
        return false;
    }
    for (int i = 2; i <= sqrt(num);i++)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    string words[] = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };
    string input;
    getline(cin, input);
    int num = 0;
    for (int i = 0; i < 3; i++)
    {
        int word_index = -1;
        for (int j = 0; j < 10; j++)
        {
            if (words[j] == input.substr(i * 5, 5))
            {
                word_index = j;
                break;
            }
        }
        if (word_index == -1)
        {
            cout << "Wrong input" << endl;
            return 0;
        }
        int next_prime = num;
        while (true)
        {
            if (isPrime(next_prime))
            {
                cout << next_prime << endl;
                break;
            }
            ++next_prime;
        }
        return 0;
    }
}
